const express = require('express')
const userinfoRouter = require('../router_handler/userinfo')

// 导入验证数据的中间件
const expressJoi = require('@escook/express-joi')

// 导入更新用户信息的校验规则
const { update_userinfo_schema, upadate_password_schema, update_avatar_schema } = require('../schema/user')

const router = express.Router()

router.get('/userinfo', userinfoRouter.getUserInfo)
router.post('/userinfo', expressJoi(update_userinfo_schema), userinfoRouter.updateUserInfo)
router.post('/updatepwd', expressJoi(upadate_password_schema), userinfoRouter.updatePassword)
router.post('/update/avatar', expressJoi(update_avatar_schema), userinfoRouter.updateAvatar)

module.exports = router